Fix duplicate test name causing compilation error in device_api_gtest - #228
Draft
KTirumalaSrihari with Copilot wants to merge 3 commits into
Draft
Fix duplicate test name causing compilation error in device_api_gtest#228KTirumalaSrihari with Copilot wants to merge 3 commits into
KTirumalaSrihari with Copilot wants to merge 3 commits into
Conversation
…XPECT_CALL Co-authored-by: KTirumalaSrihari <102281309+KTirumalaSrihari@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix failing unit tests for GetServURL in VBN builds
Fix VBN-based GetServURL tests: remove stale isDebugServicesEnabled expectations
Mar 18, 2026
…od_Labsigned_DeviceTypeProd_DbgDisabled_Locked Co-authored-by: KTirumalaSrihari <102281309+KTirumalaSrihari@users.noreply.github.com>
Copilot
AI
changed the title
Fix VBN-based GetServURL tests: remove stale isDebugServicesEnabled expectations
Fix VBN GetServURL test failures and duplicate test name compilation error
Mar 18, 2026
Copilot
AI
changed the title
Fix VBN GetServURL test failures and duplicate test name compilation error
Fix duplicate test name causing compilation error in device_api_gtest
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two
TEST_Fdefinitions shared the nameTestName_isSecureDbgSrvUnlocked_Prod_Labsigned_DeviceTypeProd_Locked, causing a C++ redefinition error that preventedrdkfw_deviceutils_gtest(and all subsequent binaries) from being built.Change
Renamed the duplicate at line 647 — which tests the
isDebugServicesEnabled() = falsepath — toTestName_isSecureDbgSrvUnlocked_Prod_Labsigned_DeviceTypeProd_DbgDisabled_Locked.The two tests now cover distinct scenarios:
...DeviceTypeProd_Locked—deviceType="prod",dbgServices=true→ locked (wrong device type)...DeviceTypeProd_DbgDisabled_Locked—deviceType="prod",dbgServices=false→ locked (wrong device type + debug disabled)Original prompt
Problem
After the
isSecureDbgSrvUnlocked()refactor in PR #205 (branchtopic/RDKEMW-13335), the CI unit test job "Execute unit tests in gtest test suite" is failing with:Root Cause
The refactor changed
GetServURL()insrc/deviceutils/device_api.cto callisSecureDbgSrvUnlocked(eBuildType)instead of directly callingisDebugServicesEnabled().For VBN builds (
BUILD_TYPE=vbn→eVBN),isSecureDbgSrvUnlocked()returnstrueimmediately on the non-PROD early-return path (line 62–64 ofdevice_api.c) without ever callingisDebugServicesEnabled():However, 4 VBN-based
GetServURLtests inunittest/deviceutils/device_api_gtest.cppstill setEXPECT_CALL(*g_DeviceUtilsMock, isDebugServicesEnabled()).Times(1), which causes gMock to report "Expected to be called exactly once, but never called" — failing those tests.Required Fix
In file
unittest/deviceutils/device_api_gtest.cpp, remove theEXPECT_CALL(*g_DeviceUtilsMock, isDebugServicesEnabled())lines from the following 4 VBN-based test cases (sinceisDebugServicesEnabled()is no longer called for non-PROD builds):TestName_GetServURL_SuccessStatered_DebugServices_Enabled(around line 642)EXPECT_CALL(*g_DeviceUtilsMock, isDebugServicesEnabled()).Times(1).WillOnce(Return(true));TestName_GetServURL_SuccessStatered_DebugServices_Disabled(around line 661)EXPECT_CALL(*g_DeviceUtilsMock, isDebugServicesEnabled()).Times(1).WillOnce(Return(false));TestName_GetServURL_SuccessSwupdate_DebugServices_Enabled(around line 756)EXPECT_CALL(*g_DeviceUtilsMock, isDebugServicesEnabled()).Times(1).WillOnce(Return(true));TestName_GetServURL_SuccessSwupdate_DebugServices_Disabled(around line 776)EXPECT_CALL(*g_DeviceUtilsMock, isDebugServicesEnabled()).Times(1).WillOnce(Return(false));These are the only changes needed. Do NOT modify any source code files — only the test file
unittest/deviceutils/device_api_gtest.cpp.Important Notes
unittest/deviceutils/device_api_gtest.cppisSecureDbgSrvUnlockedtests or PROD-basedGetServURLtests — those are correctTestName_GetServURL_SuccessStatered_Prod_DebugServices_Enabled,TestName_GetServURL_SuccessStatered_Prod_DebugServices_Disabled,TestName_GetServURL_SuccessSwupdate_Prod_DebugServices_Enabled,TestName_GetServURL_SuccessSwupdate_Prod_DebugServices_Disabled) correctly mockisDebugServicesEnabled()because the PROD path inisSecureDbgSrvUnlocked()does call it — leave those aloneThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: @Copilot Accepted Confirmation: Are you sure?
Assistant: I've kicked off a Copilot coding agent to create a pull request with the additional unit tests. You can track the progress here:
The PR will add the following new tests to maximize line coverage of the PR #205 changes:
device_api_gtest.cpp—isSecureDbgSrvUnlockedadditional tests:eUNKNOWNbuild typefalse(locked)eDEVbuild typetrueeQAbuild typetrueePROD+ dbgServices=false + deviceType=prodfalse(hits "unable to enable" log)ePROD+ labsigned empty stringfalse(hits "not enabled" log)fwdl_interface_gtest.cpp—getDeviceTypeRFCadditional tests:"PROD"(uppercase)strncasecmp"prod""TEST"(uppercase)strncasecmp"test""Prod"(mixed case)strncasecmp"prod""unknown"User: Should I add these along with the exisitng test cases or scrap them and add only these?
Assistant: You should add these along with the existing test cases — do not scrap the existing ones.
The PR already has good foundational tests covering the core scenarios (e.g., ePROD with labsigned/deviceType/dbgServices combos, NULL args, read failure, prod/test/unknown RFC values). The new tests I've proposed are complementary — they cov...
This pull request was created from Copilot chat.
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.